import time

from selenium.webdriver import ActionChains
from selenium.webdriver.support.select import Select

from WoniuBossPOM.TeachingManagement_POM import TeachingManagement
from WoniuBossPOM.All_Management_POM import All_Mamagement
class TeachingManagementTest():
    def __init__(self):
        self.tm = All_Mamagement()

    # def login(self):
    #     self.tm.get_username_ele().send_keys('WNCD000')
    #     self.tm.get_password_ele().send_keys('woniu123')
    #     # self.tm.get_verifycode_ele().send_keys('0000')
    #     self.tm.get_login_button_ele().click()
    #     time.sleep(2)





    def add_aply(self):

        self.tm.get_teaching_management_ele().click()          # 点击教学管理
        self.tm.get_overtime_apply_ele().click()               # 点击加班申请
        self.tm.get_add_button_ele().click()                   # 点击新增按钮

        self.tm.get_apply_start_time().click()                 # 点击加班申请开始时间
        self.tm.get_start_day_ele().click()                    # 点击日期
        time.sleep(2)
        self.tm.get_start_hour_ele().click()                   # 点击小时
        time.sleep(2)
        self.tm.get_start_minute_ele().click()                 # 点击分钟

        self.tm.get_apply_end_time().click()                   # 点击加班申请结束时间
        self.tm.get_end_day_ele().click()
        time.sleep(2)
        self.tm.get_end_hour_ele().click()
        time.sleep(2)
        self.tm.get_end_minute_ele().click()


        selectList = Select(self.tm.get_apply_accounting_way_ele())
        selectList.select_by_visible_text('申请调休')             # 下拉框选择申请调休

        self.tm.get_apply_reason_ele().send_keys('aaaaaaaaaa')    # 输入申请原因

        self.tm.get_submit_button_ele().click()                   # 点击提交


        # self.tm.get_confirm_button().click()                      # 点击确认
        # ActionChains(self.tm.driver).click(self.tm.get_confirm_button()).perform()


    def apply_reason(self):
        self.tm.get_teaching_management_ele().click()  # 点击教学管理
        self.tm.get_overtime_apply_ele().click()  # 点击加班申请
        self.tm.get_add_button_ele().click()  # 点击新增按钮

        self.tm.get_apply_start_time().click()  # 点击加班申请开始时间
        self.tm.get_start_day_ele().click()  # 点击日期
        time.sleep(2)
        self.tm.get_start_hour_ele().click()  # 点击小时
        time.sleep(2)
        self.tm.get_start_minute_ele().click()  # 点击分钟

        self.tm.get_apply_end_time().click()  # 点击加班申请结束时间
        self.tm.get_end_day_ele().click()
        time.sleep(2)
        self.tm.get_end_hour_ele().click()
        time.sleep(2)
        self.tm.get_end_minute_ele().click()

        selectList = Select(self.tm.get_apply_accounting_way_ele())
        selectList.select_by_visible_text('申请调休')  # 下拉框选择申请调休

        self.tm.get_apply_reason_ele().send_keys('aaaaaaaaa')  # 输入申请原因
        self.tm.get_submit_button_ele().click()                   # 点击提交
